<?php
class IndexController extends Zend_Controller_Action
{
	public function indexAction()
	{
		$this->view->form = $this->getForm();
		//this line will render the named phtml....
		echo $this->render('index');
	}
	
	public function getForm()
	{
	$form = new Zend_Form();
	$form->setAction('login')
		 ->setMethod('post');
	//create and configure username element
	$username = $form->createElement('text','username',array('label'=>'Username'));
	$username->addValidator('alnum')
			/* ->addValidator('regex',false,array(`/^[a-z]+/`)) */
			 ->addValidator('stringLength',false,array(6,20))
			 ->setRequired(true)
			 ->addFilter('StringToLower');
			 
	//create and configure password element
	$password = $form->createElement('password','password',array('label'=>'Password'));
	$password->addValidator('stringLength',false,array(6))
			 ->setRequired(true);
			 
	//Add elements to the form
	$form->addElement($username)
		 ->addElement($password)
		 ->addElement('submit','Login',array('lable'=>'Login'));
	return $form;	 
	}
	
	
}
?>